home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / ace_gpl_release / src_ansi / ace / c / screen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-05  |  3.1 KB  |  132 lines

  1. /*
  2.    ** <<ACE>>
  3.    **
  4.    ** Amiga BASIC Compiler **
  5.    **
  6.    ** Parser: screens **
  7.    ** Copyright (C) 1998 David Benn
  8.    ** 
  9.    ** This program is free software; you can redistribute it and/or
  10.    ** modify it under the terms of the GNU General Public License
  11.    ** as published by the Free Software Foundation; either version 2
  12.    ** of the License, or (at your option) any later version.
  13.    **
  14.    ** This program is distributed in the hope that it will be useful,
  15.    ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.    ** GNU General Public License for more details.
  18.    **
  19.    ** You should have received a copy of the GNU General Public License
  20.    ** along with this program; if not, write to the Free Software
  21.    ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.    **
  23.    ** Author: David J Benn
  24.    **   Date: 16th February 1994 (code removed from statement.c)
  25.  */
  26.  
  27. #include "acedef.h"
  28.  
  29. /* external */
  30. extern int sym;
  31.  
  32. /* functions */
  33. void screen (void)
  34. {
  35. /*
  36.    ** SCREEN [CLOSE|FORWARD|BACK]
  37.  */
  38.   int rword, stype;
  39.  
  40.   insymbol ();
  41.  
  42.   /* SCREEN CLOSE screen-id */
  43.   if (sym == closesym)
  44.     {
  45.       insymbol ();
  46.       make_sure_short (expr ());    /* screen-id */
  47.       gen ("move.w", "(sp)+", "d0");
  48.       gen ("jsr", "_closescreen", "  ");
  49.       enter_XREF ("_closescreen");
  50.       enter_XREF ("_IntuitionBase");
  51.     }
  52.   else
  53.     /* SCREEN FORWARD|BACK screen-id */
  54.   if (sym == forwardsym || sym == backsym)
  55.     {
  56.       rword = sym;
  57.  
  58.       insymbol ();
  59.       stype = expr ();
  60.       if (stype == stringtype)
  61.     _error (4);
  62.       else
  63.     {
  64.       /* screen-id */
  65.       make_sure_short (stype);
  66.       gen ("move.w", "(sp)+", "d0");
  67.  
  68.       /* forward or back? */
  69.       switch (rword)
  70.         {
  71.         case forwardsym:
  72.           gen ("move.w", "#1", "d1");
  73.           break;
  74.         case backsym:
  75.           gen ("move.w", "#2", "d1");
  76.           break;
  77.         }
  78.  
  79.       gen ("jsr", "_change_screen_depth", "  ");
  80.  
  81.       enter_XREF ("_change_screen_depth");
  82.       enter_XREF ("_IntuitionBase");
  83.     }
  84.     }
  85.   else
  86.     /* SCREEN screen-id,width,height,colors,mode */
  87.     {
  88.       /* open a screen */
  89.       make_sure_short (expr ());    /* screen-id */
  90.       if (sym != comma)
  91.     _error (16);
  92.       else
  93.     {
  94.       insymbol ();
  95.       make_sure_short (expr ());    /* width */
  96.       if (sym != comma)
  97.         _error (16);
  98.       else
  99.         {
  100.           insymbol ();
  101.           make_sure_short (expr ());    /* height */
  102.           if (sym != comma)
  103.         _error (16);
  104.           else
  105.         {
  106.           insymbol ();
  107.           make_sure_short (expr ());    /* depth */
  108.           if (sym != comma)
  109.             _error (16);
  110.           else
  111.             {
  112.               insymbol ();
  113.               make_sure_short (expr ());    /* mode */
  114.  
  115.               /* pop parameters */
  116.               gen ("move.w", "(sp)+", "d4");    /* mode */
  117.               gen ("move.w", "(sp)+", "d3");    /* depth */
  118.               gen ("move.w", "(sp)+", "d2");    /* height */
  119.               gen ("move.w", "(sp)+", "d1");    /* width */
  120.               gen ("move.w", "(sp)+", "d0");    /* screen-id (1-9) */
  121.  
  122.               /* open the screen */
  123.               gen ("jsr", "_openscreen", "  ");
  124.               enter_XREF ("_openscreen");
  125.               enter_XREF ("_GfxBase");
  126.             }
  127.         }
  128.         }
  129.     }
  130.     }
  131. }
  132.